# Copyright (C) Kumo inc. and its affiliates.
# Author: Jeff.li lijippy@163.com
# All rights reserved.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https:#www.gnu.org/licenses/>.
#

add_subdirectory(utils)

add_executable(
  pollux_wave_exec_test
  FilterProjectTest.cpp
  TableScanTest.cpp
  HashJoinTest.cpp
  BarrierTest.cpp
  Main.cpp)

target_link_libraries(
  pollux_wave_exec_test
  pollux_wave_exec
  pollux_wave_mock_reader
  pollux_aggregates
  pollux_dwio_common
  pollux_dwio_common_exception
  pollux_dwio_common_test_utils
  pollux_dwio_parquet_reader
  pollux_dwio_parquet_writer
  pollux_exec
  pollux_exec_test_lib
  pollux_functions_json
  pollux_functions_lib
  pollux_functions_prestosql
  pollux_functions_test_lib
  pollux_hive_connector
  pollux_memory
  pollux_serialization
  pollux_test_util
  pollux_type
  pollux_vector
  pollux_vector_fuzzer
  GTest::gtest
  GTest::gtest_main
  GTest::gmock
  Melon::melon
  fmt::fmt
  CUDA::cudart)

add_test(pollux_wave_exec_test pollux_wave_exec_test)
set_tests_properties(pollux_wave_exec_test PROPERTIES LABELS cuda_driver)

if(${POLLUX_ENABLE_BENCHMARKS})
  add_executable(pollux_wave_benchmark WaveBenchmark.cpp)

  target_link_libraries(
    pollux_wave_benchmark
    pollux_query_benchmark
    pollux_wave_exec
    pollux_wave_mock_reader
    pollux_aggregates
    pollux_dwio_common
    pollux_dwio_common_exception
    pollux_dwio_common_test_utils
    pollux_dwio_parquet_reader
    pollux_dwio_parquet_writer
    pollux_exec
    pollux_exec_test_lib
    pollux_functions_json
    pollux_functions_lib
    pollux_functions_prestosql
    pollux_functions_test_lib
    pollux_hive_connector
    pollux_memory
    pollux_serialization
    pollux_test_util
    pollux_type
    pollux_vector
    pollux_vector_fuzzer
    GTest::gtest
    GTest::gtest_main
    GTest::gmock
    Melon::melon

    Melon::melonbenchmark
    fmt::fmt
    CUDA::cudart)
endif()
